Skip to content

[CI] Check that a second build has nothing to do - #23056

Merged
guitargeek merged 3 commits into
root-project:masterfrom
guitargeek:ci-null-build-check
Aug 13, 2026
Merged

[CI] Check that a second build has nothing to do#23056
guitargeek merged 3 commits into
root-project:masterfrom
guitargeek:ci-null-build-check

Conversation

@guitargeek

@guitargeek guitargeek commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Building an already built tree twice in a row must be a no-op, apart from etc/gitinfo.txt which the gitinfotxt target rewrites on every build by design. When that is not the case, every incremental build pays for the targets that are needlessly redone plus everything depending on them.

Add a null build check that runs on all platforms right after the build: it fingerprints every file in the build tree, builds again, and reports what was written. Doing it this way rather than parsing build tool output keeps it working across Ninja, Makefiles and MSBuild alike.

The verdict is only acted on at the very end, after ctest, so that a spurious rebuild does not cost us the test results.

🤖 Done with the help of AI

This new test caught problems in Windows (which were fixed in the two first commits of this PR), as well as the AlmaLinux 8 + Ninja issue that caused #21346 to get reverted.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 22h 6m 44s ⏱️
 3 859 tests  3 858 ✅ 0 💤 1 ❌
79 509 runs  79 500 ✅ 8 💤 1 ❌

For more details on these failures, see this check.

Results for commit 90d53b9.

♻️ This comment has been updated with latest results.

@guitargeek
guitargeek force-pushed the ci-null-build-check branch 3 times, most recently from b2b7f9d to 11a4407 Compare August 11, 2026 07:55
@guitargeek
guitargeek force-pushed the ci-null-build-check branch 2 times, most recently from 859d948 to e09da1f Compare August 12, 2026 15:08
@guitargeek
guitargeek marked this pull request as ready for review August 12, 2026 16:37
Comment thread .github/workflows/root-ci-config/build_root.py
Comment thread .github/workflows/root-ci-config/null_build_check.py

@pcanal pcanal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. (If I recall correctly, we tested earlier that the test did catch some failures, we should add in the PR summary links to those tests).

ROOT_STANDARD_LIBRARY_PACKAGE(... NO_SOURCES) provided the dummy source file
that add_library() needs as the output of a custom command that touches it.
All the packages of one directory share that output, and listing one custom
command output in several independent targets that build in parallel is not
supported; core/clingutils alone has 15 of them.

Ninja and Make happen to get away with it, but with MSBuild the touch runs
again on every build, so 14 of the 15 STL dictionaries were recompiled and
relinked every time, along with everything depending on them.

Write the file at configure time instead. Nothing touches it at build time
anymore, so it cannot go stale under the targets that compile it.

🤖 Done with the help of AI
MSBuild re-executes these post-build events even when the build has
nothing to do, and `cmake -E copy` rewrites its destination
unconditionally, so every null build modified those files. Ninja and
Makefiles are immune because there POST_BUILD steps only run when the
target itself relinks.

Use `cmake -E copy_if_different` so a no-op event leaves the destination
untouched, and replace the data.h POST_BUILD hack with
configure_file(... COPYONLY), the convention the sibling test
directories already use for such runtime inputs.

🤖 Done with the help of AI
Building an already built tree twice in a row must be a no-op, apart from
etc/gitinfo.txt which the gitinfotxt target rewrites on every build by
design. When that is not the case, every incremental build pays for the
targets that are needlessly redone plus everything depending on them.

Add a null build check that runs on all platforms right after the build:
it fingerprints every file in the build tree, builds again, and reports
what was written. Doing it this way rather than parsing build tool output
keeps it working across Ninja, Makefiles and MSBuild alike.

The verdict is only acted on at the very end, after ctest, so that a
spurious rebuild does not cost us the test results.

🤖 Done with the help of AI
@guitargeek
guitargeek force-pushed the ci-null-build-check branch from e09da1f to 90d53b9 Compare August 13, 2026 06:37
@guitargeek

Copy link
Copy Markdown
Contributor Author

LGTM. (If I recall correctly, we tested earlier that the test did catch some failures, we should add in the PR summary links to those tests).

Thanks for the review! I added references in the PR description to the failures that the new check caught.

@guitargeek
guitargeek merged commit fda95b4 into root-project:master Aug 13, 2026
32 of 34 checks passed
@guitargeek
guitargeek deleted the ci-null-build-check branch August 13, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants